<?php
//OJB: Check if for excel export process
ob_start();
?>
<?php
//debug($return_arr);
?>
<table class="tablep table-bordered">
    <thead>
    <tr>
        <th>Customer</th>
        <th>Purchased Date</th>
        <th>Model</th>
        <th>30 Days <?php echo $tran_currency; ?></th>
        <th>60 Days <?php echo $tran_currency; ?></th>
        <th>90 Days Plus <?php echo $tran_currency; ?></th>
    </tr>
    </thead>
    <tbody>
    <?php
    if(isset($return_arr)){
        $data = $return_arr;
        foreach($data as $row){
            ?>
        <tr>
            <td><?php echo ucwords(strtolower($row['cell'][1]))?></td>
            <td><?php echo $row['cell'][2]?></td>
            <td><?php echo $row['cell'][3]?></td>
            <td><?php echo $row['cell'][4]?></td>
            <td><?php echo $row['cell'][5]?></td>
            <td><?php echo $row['cell'][6]?></td>
        </tr>
            <?php
        }
    }
    ?>
    </tbody>
</table>
<?php
    $content = ob_end_flush();

    $filename = $file_name;
    $filename = str_replace(array(' ', '/', '\\'), '', $filename);
    $filename .= "_Export.xls";
    header('Content-type: application/ms-excel');
    header('Content-Disposition: attachment; filename='.$filename);
    echo $content;
    die();

?>